package com.community.controller;
import com.community.dao.NoticeDao;
import com.community.dao.impl.NoticeDaoImpl;
import com.community.model.Notice;

import com.community.service.NoticeService;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@WebServlet("/AdminNotice")
public class AdminNoticeController extends HttpServlet {
    public static final Logger log =
            LoggerFactory.getLogger(AdminNoticeController.class);
    private NoticeService noticeService = new NoticeService();

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        List<Notice> notices = noticeService.getAllNotices();
        request.setAttribute("notices", notices);
        request.getRequestDispatcher("notice_manage.jsp").forward(request, response); // 转发到公告管理页面
    }
}